package com.dime.basic.api.factory;

import com.dime.basic.api.RemoteOccupationalBasicService;
import com.dime.basic.api.model.*;
import com.ruoyi.common.core.domain.R;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;

import java.util.ArrayList;
import java.util.List;

@Component
public class RemoteOccupationalBasicFallbackFactory implements FallbackFactory<RemoteOccupationalBasicService> {
private static final Logger log = LoggerFactory.getLogger(RemoteBaseCombFallbackFactory.class);

    @Override
    public RemoteOccupationalBasicService create(Throwable cause) {
        log.error("蝶美主检基础信息调用失败:{}", cause.getMessage());
        return new RemoteOccupationalBasicService() {
            @Override
            public R<OccupationalBasic> occupationalBasic(String source) {
                return R.fail("查询主检基础信息:" + cause.getMessage());
            }

            @Override
            public R<HarmDiseaseCriterion> harmDiseaseCriterions(HarmWorkStatus hws,String source) {
                return R.fail("查询疑似职业病:" + cause.getMessage());
            }

            @Override
            public R<HarmContraCriterion> harmContraCriterions(HarmWorkStatus hws,String source) {
                return R.fail("查询禁忌症:" + cause.getMessage());
            }

            @Override
            public R<List<HarmDiseaseCriterion>> harmDiseaseCriterionsByList(ArrayList<HarmWorkStatus> hws,String source) {
                return R.fail("List查询疑似职业病:" + cause.getMessage());
            }

            @Override
            public R<List<HarmContraCriterion>> harmContraCriterionsByList(ArrayList<HarmWorkStatus> hws, String source) {
                return R.fail("List查询禁忌症:" + cause.getMessage());
            }
        };
    }


}
